<!DOCTYPE html>
<html style="background: #c7c7c7">
<head lang="en">
    <meta charset="UTF-8">
    <meta name='apple-touch-fullscreen' content='yes'>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta content="fullscreen=yes,preventMove=no" name="ML-Config">
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no,email=no,address=no" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>正在拍</title>
 <link rel="stylesheet" href="/style/css/style.css"/>
    <script src="/style/js/index.js"></script>
    <script src="/style/js/jQuery.v1.8.3.min.js"></script>
  
</head>
<body>
<header class="head-top">
    <h1>
       <b>正在拍</b><i>ing</i>
    </h1>
    <h3>自己出价最高</h3>
</header>
<!--<div class="head-time">日期：2018.09.11</div>-->
<div class="container">
    <ul>
   <?php
      if($this->data)
      {
        foreach ($this->data as $v){

      ?>
        <a href="">
            <li class="settime" data-time="<?=$v['pat_count_down']?>">
                <div class="contaner-left">
                    <h3><i style="float: left;">商品名称：</i><b  style="font-weight: normal;width: 6rem;display: inline-block;"><?=$v['goods_name']?></b></h3>
                    <div class="content">
                        <h4>
                            <i>最新</i>
                            <em>¥ <?=$v['bid_price']?></em>
                        </h4>
                        <h4>
                            <b>竟拍倒计时：</b>
                            <em class="down_time">03:00:00</em>
                        </h4>
                    </div>
                </div>
           
            </li>
        </a>
 <?php
        }
      }
 ?>
    </ul>
</div>
</body>
<script>
$(function(){
	updateEndTime();
	
})
function updateEndTime()
{

var time = <?=$this->time;?>;

$(".settime").each(function(i){
	
	 var endTime= $(this).attr('data-time');
    
     var timeShow;
    
    var lag = (endTime - time); //当前时间和结束时间之间的秒数
    if(lag > 0)
    {
    	
      endTime -= 1;
   	 var secondTime = parseInt(lag);// 秒
     var minuteTime = 0;// 分
     var hourTime = 0;// 小时
     if(secondTime > 60) {//如果秒数大于60，将秒数转换成整数
         //获取分钟，除以60取整数，得到整数分钟
         minuteTime = parseInt(secondTime / 60);
         //获取秒数，秒数取佘，得到整数秒数
         secondTime = parseInt(secondTime % 60);
         secondTime = PrefixInteger(secondTime,2);
         //如果分钟大于60，将分钟转换成小时
         if(minuteTime > 60) {
             //获取小时，获取分钟除以60，得到整数小时
             hourTime = parseInt(minuteTime / 60);
             hourTime = PrefixInteger(hourTime,2);
             //获取小时后取佘的分，获取分钟除以60取佘的分
             minuteTime = parseInt(minuteTime % 60);
             minuteTime = PrefixInteger(minuteTime,2);
         }
     }
     var result = "" + secondTime;

     if(minuteTime > 0) {
         result = "" +minuteTime + ":" + result;
     }
     if(hourTime > 0) {
         result = "" +hourTime + ":" + result;
     }
    	$(this).attr('data-time',endTime);
        $(this).find('.down_time').html(result);
    }
    else
    {
        $(this).removeClass("settime");
        $(this).find('.down_time').html(0);
       
    }
});
  setTimeout("updateEndTime()",1000);
}

function PrefixInteger(num, length) {
    return (Array(length).join('0') + num).slice(-length);
}
</script>
</html>